<?php
/**
 * Created by zxk7516@foxmail.com  Date: 2017/10/20  Time: 17:36
 */

namespace app\Events;

// 设置微信菜单事件
class SetWxMenu
{
    public $menu;

    /**
     * SetWxMenu constructor.
     * @param array $menu json string
     */
    public function __construct($menu = '')
    {
        if(!empty($menu)){
            $this->menu = $menu;
        }else{
            $url =  'ybyy.51sprint.com/wx/';
            $buttons = [
                [
                    "name" => "悦宝",
                    "sub_button"  => [
                        ['name'=> '悦宝介绍','type'=>'view', 'url' => $url.'about'],
                        ['name'=>'最新课程','type'=>'view', 'url' => $url.'courses_intro'],
                        ['name'=>'教师风采', 'type' => 'view', 'url' => $url.'our_teachers']
                    ]
                ],
                [
                    "name" => "有约",
                    "sub_button"  => [
                        ['name'=> '课程预约','type'=>'view', 'url' => $url.'courses'],
                        ['name'=>'查看预约','type'=>'view', 'url' => $url.'subscribes'],
                    ]
                ],
                [
                    "name" => "服务中心",
                    "sub_button"  => [
                        ['name'=> '家长注册','type'=>'view', 'url' => $url.'regist'],
                    ]
                ],
            ];
            $this->menu = json_encode($buttons);
        }

        // TODO remove


    }
}